<?php
$v_recordtype_filter = $_SESSION['onegate_current_recordtype'];
if(isset($_REQUEST['hdn_recordtype_filter'])){
	$v_recordtype_filter = $_REQUEST['hdn_recordtype_filter'];
} 
$v_customer_record_id = 0;
if(isset($_REQUEST['hdn_customer_record_id'])){
	$v_customer_record_id = $_REQUEST['hdn_customer_record_id'];
}
$v_code= "";
if(isset($_REQUEST['txt_code'])){
	$v_code = _replace_bad_char($_REQUEST['txt_code']);
}
/*
if((!_check_permission_on_function($_SESSION['staff_id'], $_ISA_APP_CODE, $function_code))){?>
	<script>
		alert("<? echo _CONST_FUNCTION_PERMISSION_ERROR; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<? echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?
	exit;
}
*/
if(_is_sqlserver()){
	//Cap nhat noi dung cau hoi
	$sql = "Exec Onegate_CustomerRecordDelete " ;
	$sql = $sql . "'" .  $v_customer_record_id ."'" ;
	//echo $sql; exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$rs = $ado_conn->GetRow($sql); 
	$v_error = _replace_bad_char(trim($rs['RET_ERROR']));
	if($v_record_id <= 0){
		$v_record_id = $rs['NEW_ID'];
	}
}
sleep(0);
if (!is_null($v_error) && $v_error<>""){?>
	<script>
		alert("<?php echo $v_error; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<?php echo $v_goto_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?php
	exit;
}
?>
<form action="index.php" method="post" name="f_back">
	<input type="hidden" name="fuseaction" value="<?php echo $fuseaction_back; ?>">
</form>
<Script language="javascript">
	window.location="<?php echo _CONST_HOMEPAGE_URL_PATH;?>";
</Script>